home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news.sprintlink.net!eskimo!news
- From: mag@eskimo.com (mAg)
- Subject: Re: Help, best way to compare doubles
- X-Nntp-Posting-Host: tia1.eskimo.com
- Message-ID: <DLD5Kp.JME@eskimo.com>
- Sender: news@eskimo.com (News User Id)
- Organization: *.*
- X-Newsreader: WinVN 0.93.10
- References: <4da169$mm4@mercury.IntNet.net> <4dfdtl$phv@nntp.crl.com>
- Date: Thu, 18 Jan 1996 06:19:36 GMT
-
- In article <4dfdtl$phv@nntp.crl.com> (16 Jan 1996 05:43:17 GMT),
- bivey@ecf2.puc.edu says :
- >
- >Jeff Tomich (jtomich@IntNet.net) wrote:
- >: Looking for a way to compare doubles for equality.
- >
- >: thanks, Jeff
- >
- >The first question to ask is "how equal"? In general, one picks some
- >error limit, such as e = 1E-6; then uses it in this form:
- >
- > if (fabs(n1 - n2) < e) // then they are considered equal
- > else // they are considered different
- >
-
- "How equal" is irrelevant. "Equal to" comparison produces a boolean result
- True or False.
-
- '==' is good enough
-
-
- >--------------------------------------------------------------------------
- ---
- >Bruce Ivey Dept of Physics & Computer Science Pacific Union
- College
- >Angwin, CA 94508 bivey@puc.edu (707)
- 965-7269
- >==========================================================================
- ===
-
- --
- /* --------------------------------------------------------
- MAG@ESKIMO.COM
- http://www.eskimo.com/~mag/index.html
- ***********************************************************
- To understand recursion one must first understand recursion
- ***********************************************************
- -------------------------------------------------------- */
-
-